New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

entrance-decorator

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

entrance-decorator

A minimal solution of dependency injection for projects that scale.

  • 0.2.6
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Entrance Decorator

A minimal solution of dependency injection for projects that scale.

Why

🙂

Installation

yarn add entrance-decorator

Usage

Define entrances

import {entrance} from 'entrance-decorator';

export class Entrances {
  constructor(private url: string) {}

  @entrance
  get uiService() {
    return new UIService(this.errorService);
  }

  @entrance
  get errorService() {
    return new ErrorService({
      baseURL: this.url,
    });
  }
}

Extend/override entrances

import {entrance} from 'entrance-decorator';

export class MobileEntrances extends Entrances {
  // Extend entrance
  @entrance
  get mobileService() {
    return new MobileService(this.errorService);
  }

  // Override entrance
  @entrance
  get uiService() {
    return new MobileUIService(this.errorService);
  }
}

Use entrances

const entrances = new Entrances('https://makeflow.com');

You may use the entrances object in whatever way you want. For example, we use Context in React (in a decorator manner) and use something like entrances.launchServer() in server-side applications.

What it does

Cache and circular dependency check, nothing else.

License

MIT License.

FAQs

Package last updated on 07 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc